import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MerVO, MerForm, MerQuery } from '@/api/shopping/mer/types';

/**
 * 查询服务商家列表
 * @param query
 * @returns {*}
 */

export const listMer = (query?: MerQuery): AxiosPromise<MerVO[]> => {
  return request({
    url: '/shopping/mer/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询服务商家详细
 * @param id
 */
export const getMer = (id: string | number): AxiosPromise<MerVO> => {
  return request({
    url: '/shopping/mer/' + id,
    method: 'get'
  });
};

/**
 * 新增服务商家
 * @param data
 */
export const addMer = (data: MerForm) => {
  return request({
    url: '/shopping/mer',
    method: 'post',
    data: data
  });
};

/**
 * 修改服务商家
 * @param data
 */
export const updateMer = (data: MerForm) => {
  return request({
    url: '/shopping/mer',
    method: 'put',
    data: data
  });
};

/**
 * 删除服务商家
 * @param id
 */
export const delMer = (id: string | number | Array<string | number>) => {
  return request({
    url: '/shopping/mer/' + id,
    method: 'delete'
  });
};
